﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BaseEntities;
using BusinessLogic;

namespace Mock1Group6
{
    public partial class Withdraw2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                txtenteramount.Focus();
            }
        }

        protected void btn1_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "1";
        }

        protected void btn2_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "2";
        }

        protected void btn3_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "3";
        }

        protected void btn4_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "4";
        }

        protected void btn5_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "5";
        }

        protected void btn6_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "6";
        }

        protected void btn7_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "7";
        }

        protected void btn8_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "8";
        }

        protected void btn9_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "9";
        }

        protected void btn0_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "0";
        }

        protected void btnCham_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "0";
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            
        }

        protected void btnClear_Click(object sender, EventArgs e)
        {
            txtenteramount.Text = "";
        }
        public string abc123 { get; set; }
        protected void btnEnter_Click(object sender, EventArgs e)
        {
            decimal amount =decimal.Parse( txtenteramount.Text);
            string cardNo = abc123;
            if ((WithdrawLogic.CheckWithdrawCash(amount, cardNo) == true) &&
                (WithdrawLogic.CheckCashWithMinMaxValue(amount, cardNo) == true) &&
                (WithdrawLogic.CheckCashWithMod(amount, cardNo) == true))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Withdraw success');", true);
                Response.Redirect("trang rut hoa don");
                //WithdrawLogic.WriteLog();
            }
        }

        protected void Button5_Click(object sender, EventArgs e)
        {
            decimal amount = decimal.Parse(txtenteramount.Text);
            string cardNo = abc123;
            if ((WithdrawLogic.CheckWithdrawCash(amount, cardNo) == true) &&
                (WithdrawLogic.CheckCashWithMinMaxValue(amount, cardNo) == true) &&
                (WithdrawLogic.CheckCashWithMod(amount, cardNo) == true))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Withdraw success');", true);
                Response.Redirect("trang rut hoa don");
                //WithdrawLogic.WriteLog();
            }
        }

        protected void Button6_Click(object sender, EventArgs e)
        {
            Response.Redirect("Withdraw.aspx");
        }

    }
}